<!DOCTYPE HTML>
<!--generated with sswg-->
<html lang="en">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<head>
    <title>color</title>
    <link rel="stylesheet" href="../sswg.css">
    <link rel="stylesheet" href="../style.css">
    <link rel="icon" type="image/x-icon" href="favicon.ico">
</head>
<body>
<div style="max-width:1200px; margin:auto;">
<div style="text-align:left;">
<h1 id="color">
color
</h1><gray>&lt;/&gt;</gray><a href="https://github.com/pokepetter/ursina/tree/v8_0_0/ursina/color.py"> ursina.color</a><br>
<h2 id="Variables">
Variables
</h2><h3 id=".rgb32">
.rgb32
</h3><gray>default: </gray><span>rgba32</span><br>
<hr></hr><br>
<h3 id=".rgb">
.rgb
</h3><gray>default: </gray><span>rgba</span><br>
<hr></hr><br>
<h3 id=".white">
.white
</h3><gray>default: </gray><span>hsv(0, 0, 1)</span><br>
<hr></hr><br>
<h3 id=".smoke">
.smoke
</h3><gray>default: </gray><span>hsv(0, 0, 0.96)</span><br>
<hr></hr><br>
<h3 id=".light_gray">
.light_gray
</h3><gray>default: </gray><span>hsv(0, 0, 0.75)</span><br>
<hr></hr><br>
<h3 id=".gray">
.gray
</h3><gray>default: </gray><span>hsv(0, 0, 0.5)</span><br>
<hr></hr><br>
<h3 id=".dark_gray">
.dark_gray
</h3><gray>default: </gray><span>hsv(0, 0, 0.25)</span><br>
<hr></hr><br>
<h3 id=".black">
.black
</h3><gray>default: </gray><span>hsv(0, 0, 0)</span><br>
<hr></hr><br>
<h3 id=".red">
.red
</h3><gray>default: </gray><span>hsv(0, 1, 1)</span><br>
<hr></hr><br>
<h3 id=".orange">
.orange
</h3><gray>default: </gray><span>hsv(30, 1, 1)</span><br>
<hr></hr><br>
<h3 id=".yellow">
.yellow
</h3><gray>default: </gray><span>hsv(60, 1, 1)</span><br>
<hr></hr><br>
<h3 id=".lime">
.lime
</h3><gray>default: </gray><span>hsv(90, 1, 1)</span><br>
<hr></hr><br>
<h3 id=".green">
.green
</h3><gray>default: </gray><span>hsv(120, 1, 1)</span><br>
<hr></hr><br>
<h3 id=".turquoise">
.turquoise
</h3><gray>default: </gray><span>hsv(150, 1, 1)</span><br>
<hr></hr><br>
<h3 id=".cyan">
.cyan
</h3><gray>default: </gray><span>hsv(180, 1, 1)</span><br>
<hr></hr><br>
<h3 id=".azure">
.azure
</h3><gray>default: </gray><span>hsv(210, 1, 1)</span><br>
<hr></hr><br>
<h3 id=".blue">
.blue
</h3><gray>default: </gray><span>hsv(240, 1, 1)</span><br>
<hr></hr><br>
<h3 id=".violet">
.violet
</h3><gray>default: </gray><span>hsv(270, 1, 1)</span><br>
<hr></hr><br>
<h3 id=".magenta">
.magenta
</h3><gray>default: </gray><span>hsv(300, 1, 1)</span><br>
<hr></hr><br>
<h3 id=".pink">
.pink
</h3><gray>default: </gray><span>hsv(330, 1, 1)</span><br>
<hr></hr><br>
<h3 id=".brown">
.brown
</h3><gray>default: </gray><span>rgb32(165, 42, 42)</span><br>
<hr></hr><br>
<h3 id=".olive">
.olive
</h3><gray>default: </gray><span>rgb32(128, 128, 0)</span><br>
<hr></hr><br>
<h3 id=".peach">
.peach
</h3><gray>default: </gray><span>rgb32(255, 218, 185)</span><br>
<hr></hr><br>
<h3 id=".gold">
.gold
</h3><gray>default: </gray><span>rgb32(255, 215, 0)</span><br>
<hr></hr><br>
<h3 id=".salmon">
.salmon
</h3><gray>default: </gray><span>rgb32(250, 128, 114)</span><br>
<hr></hr><br>
<h3 id=".clear">
.clear
</h3><gray>default: </gray><span>rgba(0, 0, 0, 0)</span><br>
<hr></hr><br>
<h3 id=".white10">
.white10
</h3><gray>default: </gray><span>rgba(1, 1, 1, 0.1)</span><br>
<hr></hr><br>
<h3 id=".white33">
.white33
</h3><gray>default: </gray><span>rgba(1, 1, 1, 0.33)</span><br>
<hr></hr><br>
<h3 id=".white50">
.white50
</h3><gray>default: </gray><span>rgba(1, 1, 1, 0.5)</span><br>
<hr></hr><br>
<h3 id=".white66">
.white66
</h3><gray>default: </gray><span>rgba(1, 1, 1, 0.66)</span><br>
<hr></hr><br>
<h3 id=".black10">
.black10
</h3><gray>default: </gray><span>rgba(0, 0, 0, 0.1)</span><br>
<hr></hr><br>
<h3 id=".black33">
.black33
</h3><gray>default: </gray><span>rgba(0, 0, 0, 0.33)</span><br>
<hr></hr><br>
<h3 id=".black50">
.black50
</h3><gray>default: </gray><span>rgba(0, 0, 0, 0.5)</span><br>
<hr></hr><br>
<h3 id=".black66">
.black66
</h3><gray>default: </gray><span>rgba(0, 0, 0, 0.66)</span><br>
<hr></hr><br>
<h3 id=".black90">
.black90
</h3><gray>default: </gray><span>rgba(0, 0, 0, 0.9)</span><br>
<hr></hr><br>
<h3 id=".text">
.text
</h3><gray>default: </gray><span>smoke</span><br>
<hr></hr><br>
<h3 id=".light_text">
.light_text
</h3><gray>default: </gray><span>smoke</span><br>
<hr></hr><br>
<h3 id=".dark_text">
.dark_text
</h3><gray>default: </gray><span>hsv(0, 0, 0.1)</span><br>
<hr></hr><br>
<h3 id=".text_color">
.text_color
</h3><gray>default: </gray><span>light_text</span><br>
<hr></hr><br>
<h3 id=".color_names">
.color_names
</h3><gray>default: </gray><span>('white', 'smoke', 'light_gray', 'gray', 'dark_gra...</span><br>
<hr></hr><br>
<h3 id=".colors">
.colors
</h3><gray>default: </gray><span>dict()</span><br>
<hr></hr><br>
<h2 id="Functions">
Functions
</h2><h3 id="hsv()">
hsv()
</h3><code_block id="code_block_0"><button class="copy_code_button" onclick="copy_to_clipboard(code_block_0)">copy</button>hsv(h=None, s=None, v=None, a=<yellow>1</yellow>.<yellow>0</yellow>)
</code_block>
<div class="links">  <a href="https://github.com/pokepetter/ursina/tree/v8_0_0/ursina/color.py#L63" alt="Source Code" title="View Source Code" style="font-size:.75em;">&lt;/&gt;</a>  <a href="#hsv" onclick="navigator.clipboard.writeText('#hsv')" title="Copy permalink">◃-</a></div><br>
<hr></hr><br>
<h3 id="rgba32()">
rgba32()
</h3><code_block id="code_block_1"><button class="copy_code_button" onclick="copy_to_clipboard(code_block_1)">copy</button>rgba<yellow>3</yellow>2(r=None, g=None, b=None, a=<yellow>2</yellow><yellow>5</yellow><yellow>5</yellow>)
</code_block>
<div class="links">  <a href="https://github.com/pokepetter/ursina/tree/v8_0_0/ursina/color.py#L66" alt="Source Code" title="View Source Code" style="font-size:.75em;">&lt;/&gt;</a>  <a href="#rgba32" onclick="navigator.clipboard.writeText('#rgba32')" title="Copy permalink">◃-</a></div><br>
<hr></hr><br>
<h3 id="rgba()">
rgba()
</h3><code_block id="code_block_2"><button class="copy_code_button" onclick="copy_to_clipboard(code_block_2)">copy</button>rgba(r=None, g=None, b=None, a=<yellow>1</yellow>.<yellow>0</yellow>)
</code_block>
<div class="links">  <a href="https://github.com/pokepetter/ursina/tree/v8_0_0/ursina/color.py#L71" alt="Source Code" title="View Source Code" style="font-size:.75em;">&lt;/&gt;</a>  <a href="#rgba" onclick="navigator.clipboard.writeText('#rgba')" title="Copy permalink">◃-</a></div><br>
<hr></hr><br>
<h3 id="to_hsv()">
to_hsv()
</h3><code_block id="code_block_3"><button class="copy_code_button" onclick="copy_to_clipboard(code_block_3)">copy</button>to_hsv(<olive>color</olive>=None)
</code_block>
<div class="links">  <a href="https://github.com/pokepetter/ursina/tree/v8_0_0/ursina/color.py#L76" alt="Source Code" title="View Source Code" style="font-size:.75em;">&lt;/&gt;</a>  <a href="#to_hsv" onclick="navigator.clipboard.writeText('#to_hsv')" title="Copy permalink">◃-</a></div><br>
<hr></hr><br>
<h3 id="hex()">
hex()
</h3><code_block id="code_block_4"><button class="copy_code_button" onclick="copy_to_clipboard(code_block_4)">copy</button>hex(value=None)
</code_block>
<div class="links">  <a href="https://github.com/pokepetter/ursina/tree/v8_0_0/ursina/color.py#L79" alt="Source Code" title="View Source Code" style="font-size:.75em;">&lt;/&gt;</a>  <a href="#hex" onclick="navigator.clipboard.writeText('#hex')" title="Copy permalink">◃-</a></div><br>
<hr></hr><br>
<h3 id="rgb_to_hex()">
rgb_to_hex()
</h3><code_block id="code_block_5"><button class="copy_code_button" onclick="copy_to_clipboard(code_block_5)">copy</button>rgb_to_hex(r=None, g=None, b=None, a=<yellow>1</yellow>.<yellow>0</yellow>)
</code_block>
<div class="links">  <a href="https://github.com/pokepetter/ursina/tree/v8_0_0/ursina/color.py#L87" alt="Source Code" title="View Source Code" style="font-size:.75em;">&lt;/&gt;</a>  <a href="#rgb_to_hex" onclick="navigator.clipboard.writeText('#rgb_to_hex')" title="Copy permalink">◃-</a></div><br>
<hr></hr><br>
<h3 id="brightness()">
brightness()
</h3><code_block id="code_block_6"><button class="copy_code_button" onclick="copy_to_clipboard(code_block_6)">copy</button>brightness(<olive>color</olive>=None)
</code_block>
<div class="links">  <a href="https://github.com/pokepetter/ursina/tree/v8_0_0/ursina/color.py#L91" alt="Source Code" title="View Source Code" style="font-size:.75em;">&lt;/&gt;</a>  <a href="#brightness" onclick="navigator.clipboard.writeText('#brightness')" title="Copy permalink">◃-</a></div><br>
<hr></hr><br>
<h3 id="inverse()">
inverse()
</h3><code_block id="code_block_7"><button class="copy_code_button" onclick="copy_to_clipboard(code_block_7)">copy</button>inverse(<olive>color</olive>=None)
</code_block>
<div class="links">  <a href="https://github.com/pokepetter/ursina/tree/v8_0_0/ursina/color.py#L96" alt="Source Code" title="View Source Code" style="font-size:.75em;">&lt;/&gt;</a>  <a href="#inverse" onclick="navigator.clipboard.writeText('#inverse')" title="Copy permalink">◃-</a></div><br>
<hr></hr><br>
<h3 id="random_color()">
random_color()
</h3><div class="links">  <a href="https://github.com/pokepetter/ursina/tree/v8_0_0/ursina/color.py#L101" alt="Source Code" title="View Source Code" style="font-size:.75em;">&lt;/&gt;</a>  <a href="#random_color" onclick="navigator.clipboard.writeText('#random_color')" title="Copy permalink">◃-</a></div><br>
<hr></hr><br>
<h3 id="tint()">
tint()
</h3><code_block id="code_block_8"><button class="copy_code_button" onclick="copy_to_clipboard(code_block_8)">copy</button>tint(<olive>color</olive>=None, amount=<yellow>0</yellow>.<yellow>2</yellow>)
</code_block>
<div class="links">  <a href="https://github.com/pokepetter/ursina/tree/v8_0_0/ursina/color.py#L104" alt="Source Code" title="View Source Code" style="font-size:.75em;">&lt;/&gt;</a>  <a href="#tint" onclick="navigator.clipboard.writeText('#tint')" title="Copy permalink">◃-</a></div><br>
<hr></hr><br>
<h2 id="Examples">
Examples
</h2><br>
<code_block id="code_block_9"><button class="copy_code_button" onclick="copy_to_clipboard(code_block_9)">copy</button><purple>from</purple> ursina <purple>import</purple> *
<purple>from</purple> ursina <purple>import</purple> Ursina, <olive>Entity</olive>, Button, Quad, grid_layout, color
<purple>from</purple> ursina.ursinastuff <purple>import</purple> _test
app = Ursina()

_test(hsv(<yellow>3</yellow><yellow>0</yellow>,<yellow>1</yellow>,<yellow>1</yellow>) == color.orange)
_test(color.brightness(color.blue) == <yellow>1</yellow>.<yellow>0</yellow>)
_test(color.red.rgb == (<yellow>1</yellow>.<yellow>0</yellow>, <yellow>0</yellow>.<yellow>0</yellow>, <yellow>0</yellow>.<yellow>0</yellow>))
_test(color.red.rgba == (<yellow>1</yellow>.<yellow>0</yellow>, <yellow>0</yellow>.<yellow>0</yellow>, <yellow>0</yellow>.<yellow>0</yellow>, <yellow>1</yellow>.<yellow>0</yellow>))

p = <olive>Entity</olive>(x=-<yellow>2</yellow>)
<purple>for</purple> key in color.colors:
&nbsp;&nbsp;&nbsp;&nbsp;<blue>print</blue>(key)
&nbsp;&nbsp;&nbsp;&nbsp;b = Button(<olive>parent</olive>=p, <olive>model</olive>=Quad(<yellow>0</yellow>), <olive>color</olive>=color.colors[key], <olive>text</olive>=key)
&nbsp;&nbsp;&nbsp;&nbsp;b.text_entity.scale *= .<yellow>5</yellow>

grid_layout(p.children, max_x=<yellow>8</yellow>)

<purple>for</purple> name in (<green>'r'</green>, <green>'g'</green>, <green>'b'</green>, <green>'h'</green>, <green>'s'</green>, <green>'v'</green>, <green>'brightness'</green>):
&nbsp;&nbsp;&nbsp;&nbsp;<blue>print</blue>(name + <green>':'</green>, <blue>getattr</blue>(color.random_color(), name))

e = <olive>Entity</olive>(<olive>model</olive>=<green>'cube'</green>, <olive>color</olive>=color.lime)
<blue>print</blue>(e.color.name)
<blue>print</blue>(<green>'rgb to hex:'</green>, color.rgb_to_hex(*color.blue))
e.color = color.rgba<yellow>3</yellow>2(<yellow>1</yellow>,<yellow>2</yellow>,<yellow>3</yellow>)
app.run()

</code_block>
<div class="sidebar"><span>8.0.0</span><br>
Basics<br>
  <a href="ursina.html">Ursina</a><br>
  <a href="entity.html">Entity</a><br>
  <a href="button.html">Button</a><br>
  <a href="sprite.html">Sprite</a><br>
  <a href="text.html">Text</a><br>
  <a href="audio.html">Audio</a><br>
<br>
Core Modules<br>
  <a href="camera.html">camera</a><br>
  <a href="mouse.html">mouse</a><br>
  <a href="window.html">window</a><br>
  <a href="application.html">application</a><br>
  <a href="scene.html">scene</a><br>
<br>
Graphics<br>
  <a href="color.html">color</a><br>
  <a href="mesh.html">Mesh</a><br>
  <a href="shader.html">Shader</a><br>
  <a href="texture.html">Texture</a><br>
  <a href="light.html">Light</a><br>
  <a href="directional_light.html">DirectionalLight</a><br>
  <a href="point_light.html">PointLight</a><br>
  <a href="ambient_light.html">AmbientLight</a><br>
  <a href="spot_light.html">SpotLight</a><br>
<br>
Procedural Models<br>
  <a href="quad.html">Quad</a><br>
  <a href="circle.html">Circle</a><br>
  <a href="plane.html">Plane</a><br>
  <a href="grid.html">Grid</a><br>
  <a href="cone.html">Cone</a><br>
  <a href="cylinder.html">Cylinder</a><br>
  <a href="pipe.html">Pipe</a><br>
  <a href="terrain.html">Terrain</a><br>
<br>
modules<br>
  <a href="input_handler.html">input_handler</a><br>
  <a href="mesh_importer.html">mesh_importer</a><br>
  <a href="texture_importer.html">texture_importer</a><br>
  <a href="string_utilities.html">string_utilities</a><br>
<br>
Animation<br>
  <a href="animation.html">Animation</a><br>
  <a href="frame_animation3d.html">FrameAnimation3d</a><br>
  <a href="sprite_sheet_animation.html">SpriteSheetAnimation</a><br>
  <a href="animator.html">Animator</a><br>
  <a href="trail_renderer.html">TrailRenderer</a><br>
  <a href="curve.html">curve</a><br>
<br>
Math<br>
  <a href="ursinamath.html">ursinamath</a><br>
  <a href="vec2.html">Vec2</a><br>
  <a href="vec3.html">Vec3</a><br>
  <a href="vec4.html">Vec4</a><br>
  <a href="cubic_bezier.html">CubicBezier</a><br>
  <a href="array_tools.html">array_tools</a><br>
  <a href="array2_d.html">Array2D</a><br>
  <a href="array3_d.html">Array3D</a><br>
<br>
Gameplay<br>
  <a href="ursinastuff.html">ursinastuff</a><br>
  <a href="sequence.html">Sequence</a><br>
  <a href="func.html">Func</a><br>
  <a href="keys.html">Keys</a><br>
<br>
Collision<br>
  <a href="raycast.html">raycast</a><br>
  <a href="terraincast.html">terraincast</a><br>
  <a href="boxcast.html">boxcast</a><br>
  <a href="hit_info.html">HitInfo</a><br>
  <a href="collider.html">Collider</a><br>
  <a href="box_collider.html">BoxCollider</a><br>
  <a href="sphere_collider.html">SphereCollider</a><br>
  <a href="mesh_collider.html">MeshCollider</a><br>
<br>
Prefabs<br>
  <a href="sky.html">Sky</a><br>
  <a href="editor_camera.html">EditorCamera</a><br>
  <a href="tilemap.html">Tilemap</a><br>
  <a href="first_person_controller.html">FirstPersonController</a><br>
  <a href="platformer_controller2d.html">PlatformerController2d</a><br>
  <a href="conversation.html">Conversation</a><br>
<br>
UI<br>
  <a href="button.html">Button</a><br>
  <a href="draggable.html">Draggable</a><br>
  <a href="tooltip.html">Tooltip</a><br>
  <a href="slider.html">Slider</a><br>
  <a href="thin_slider.html">ThinSlider</a><br>
  <a href="text_field.html">TextField</a><br>
  <a href="input_field.html">InputField</a><br>
  <a href="content_types.html">ContentTypes</a><br>
  <a href="checkbox.html">Checkbox</a><br>
  <a href="button_list.html">ButtonList</a><br>
  <a href="button_group.html">ButtonGroup</a><br>
  <a href="window_panel.html">WindowPanel</a><br>
  <a href="file_browser.html">FileBrowser</a><br>
  <a href="file_browser_save.html">FileBrowserSave</a><br>
  <a href="dropdown_menu.html">DropdownMenu</a><br>
  <a href="radial_menu.html">RadialMenu</a><br>
  <a href="health_bar.html">HealthBar</a><br>
<br>
Editor<br>
  <a href="hot_reloader.html">HotReloader</a><br>
  <a href="grid_editor.html">GridEditor</a><br>
  <a href="pixel_editor.html">PixelEditor</a><br>
  <a href="ascii_editor.html">ASCIIEditor</a><br>
  <a href="color_picker.html">ColorPicker</a><br>
<br>
Scripts<br>
  <a href="grid_layout.html">grid_layout</a><br>
  <a href="duplicate.html">duplicate</a><br>
  <a href="smooth_follow.html">SmoothFollow</a><br>
  <a href="scrollable.html">Scrollable</a><br>
  <a href="noclip_mode.html">NoclipMode</a><br>
  <a href="noclip_mode2d.html">NoclipMode2d</a><br>
  <a href="build.html">build</a><br>
<br>
Assets<br>
  <a href="models.html">models</a><br>
  <a href="textures.html">textures</a><br>
<br>
Shaders<br>
  <a href="unlit_shader.html">unlit_shader</a><br>
  <a href="lit_with_shadows_shader.html">lit_with_shadows_shader</a><br>
  <a href="matcap_shader.html">matcap_shader</a><br>
  <a href="colored_lights_shader.html">colored_lights_shader</a><br>
  <a href="fresnel_shader.html">fresnel_shader</a><br>
  <a href="projector_shader.html">projector_shader</a><br>
  <a href="texture_blend_shader.html">texture_blend_shader</a><br>
  <a href="instancing_shader.html">instancing_shader</a><br>
  <a href="triplanar_shader.html">triplanar_shader</a><br>
  <a href="normals_shader.html">normals_shader</a><br>
  <a href="transition_shader.html">transition_shader</a><br>
  <a href="fxaa.html">fxaa</a><br>
  <a href="ssao.html">ssao</a><br>
  <a href="camera_outline_shader.html">camera_outline_shader</a><br>
  <a href="pixelation_shader.html">pixelation_shader</a><br>
  <a href="camera_contrast.html">camera_contrast</a><br>
  <a href="camera_vertical_blur.html">camera_vertical_blur</a><br>
  <a href="camera_grayscale.html">camera_grayscale</a><br>
</div><br>
<script>
function copy_to_clipboard(containerid) {
    var range = document.createRange()
    range.selectNode(containerid)
    window.getSelection().removeAllRanges()
    window.getSelection().addRange(range)
    document.execCommand("copy")
    window.getSelection().removeAllRanges()
}
</script>
<br>
<br>
</body>
</html><style>
h1 {margin-bottom:0em; margin-top:1em}
h2 {margin-bottom:.5em;}
h3 {margin:0em; font-size:1em;}
code_block {margin-top:.0em; margin-bottom:1em;}
hr {border-color:gray; opacity:.25;}
.links {width:fit-content;}
.links a {text-decoration:none; opacity:.5;}
</style>
